#!/bin/bash

revision=""
upload=1
twitter=""

while [ "$#" -gt 0 ]
do
case "$1" in
--revision|-r)
revision="-r $2"
upload=0
break
;;
--noupload|-n)
upload=0
break
;;
--twitter|-t)
twitter="$2"
break
;;
*)
echo "$CMDNAME: invalid option: $1" 1>&2
exit 1
;;
esac
shift
done

cd /tmp

echo "doing checkout ($revision)"

if [ -f /tmp/upsferry ]; then
rm /tmp/upsferry
fi
svn co $revision http://upsferry.googlecode.com/svn/trunk/ upsferry

cd /tmp/upsferry

buildDate=`/bin/date +"%Y.%m.%d.%H"`
v=`svnversion -n /tmp/upsferry`

find . | grep \.svn$ | xargs rm -rf

echo building project

ant build -lib /htmlparser1_6/lib/htmlparser.jar

if [ $? != 0 ]; then
echo "Bad build for UPS Ferry"
say "bad build!"
else

say "done building"

fi

rm -rf /tmp/upsferry

